package com.inspur.edp.ai.flow.exception;

import io.iec.edp.caf.commons.exception.CAFRuntimeException;
import io.iec.edp.caf.commons.exception.ExceptionLevel;

/**
 * @author lizhaorui
 * @date 2025/10/11
 * @description
 */
public class FlowBizException  extends CAFRuntimeException {

    private static String SERVICE_UNIT_CODE = "pfcommon";

    private static String RESOURCE_FILE = "ai_flow_common.properties";


    public FlowBizException(String exceptionCode, Exception cause, boolean bizException, Object... messages) {
        super(SERVICE_UNIT_CODE, RESOURCE_FILE, exceptionCode, convertMessageParams(messages), cause, ExceptionLevel.Warning, bizException);
    }


    private static String[] convertMessageParams(Object... params) {
        if (params == null || params.length == 0) {
            return null;
        }
        String[] messageParams = new String[params.length];
        for (int i = 0; i < params.length; i++) {
            Object param = params[i];
            String str = param.toString();
            messageParams[i] = str;
        }
        return messageParams;
    }
}